home *** CD-ROM | disk | FTP | other *** search
/ The Best of MacTutor - S…e Code for Volumes 1 to 5 / The Best of MacTutor - Source Code for Volume 1-5 (Wayzata Technology)(6031)(1990).bin / Source Code / #50 (Nov 89) / MIDIArp.Application / MIDIArp.Application⁄LICENSE / MIDIArp.h < prev    next >
Text File  |  1989-06-09  |  4KB  |  203 lines

  1. /*
  2.     File:        MIDIArp.h   
  3.     Usage:        MIDI Manager Arpeggiator Program.
  4.     Purpose:    Apple MIDI Manager Demo.
  5.     Authors:        Fred Malouf, 
  6.                     Don Marsh,
  7.                     Don Veca.
  8.     Date:        April 1989
  9.     
  10. */
  11.  
  12.  
  13.     /* Standard Menu Constants */
  14. #define    menuBar            128        /* Application's menu bar ID */
  15. #define    appleMenu        128        /* Apple Menu */
  16. #define aboutItem        1
  17. #define fileMenu        129        /* File Menu */
  18. #define    closeItem        4
  19. #define quitItem        12
  20. #define    editMenu        130        /* Edit Menu */
  21. #define    undoItem        1
  22. #define    cutItem            3
  23. #define    copyItem        4
  24. #define    pasteItem        5
  25. #define    clearItem        6
  26.  
  27.  
  28.     /* Main Dialog Res and Item ID's */
  29. #define mainDialogID        2000
  30. #define quitID                1
  31. #define    patternPromptID        2
  32. #define patternUpID            3
  33. #define patternDownID        4
  34. #define patternUpDownID        5
  35. #define patternDownUpID        6
  36. #define patternRandomID        7
  37. #define speedPromptID        8
  38. #define speedVeryFastID        9
  39. #define speedFastID            10
  40. #define speedMediumID        11
  41. #define speedSlowID            12
  42. #define speedVerySlowID        13
  43.  
  44.     /* Alert Box Res ID's */
  45. #define arpAlertBoxID        12345
  46. #define arpAboutAlertID        13554
  47.  
  48. /*
  49.     MIDIArp Time, Input, and Output Port 
  50.     Info Record Resource ID's.
  51. */
  52. #define portResType                'port'
  53. #define timePortResInfoID        128        
  54. #define inputPortResInfoID        129    
  55. #define outputPortResInfoID        130    
  56.  
  57.     /* MIDIArp Constants */
  58. #define noteTblSize            32
  59. #define goingUp                1
  60. #define goingDown            0
  61. #define speedVeryFast        50        /* Time in milliseconds */
  62. #define speedFast            100
  63. #define speedMedium            200
  64. #define speedSlow            300
  65. #define speedVerySlow        500
  66. #define noteDuration        (ArpGlobals.Tempo * 0.95)
  67.  
  68. /* 
  69.     MIDIMgr Constants 
  70. */
  71. #define arpClientID        'MArp'
  72. #define arpIcon            128
  73. #define timePortID        'Atim'
  74. #define inputPortID        'Bin '
  75. #define outputPortID    'Cout'
  76.  
  77. #define keyOnOffPacketSize    9
  78. #define stdPacketFlags        0
  79. #define flagsTimeStampMask    0x7F
  80.  
  81. #define noTimeBaseRefNum    0
  82. #define noClient            '    '
  83. #define noReadHook            0L
  84. #define noTimeProc            0L
  85. #define zeroTime            0L
  86. #define zeroPeriod            0L
  87. #define refCon0                0L
  88. #define timePortBuffSize    0L
  89. #define inputPortBuffSize    2048
  90. #define outputPortBuffSize    0L
  91.  
  92.     /* Misc Constants */
  93. #define charEnterKey        0x03
  94.  
  95.  
  96.     // KeyOn KeyOff data structure.
  97. typedef struct 
  98. {    unsigned char    Channel;
  99.     unsigned char    Note;
  100.     unsigned char    Velocity;
  101.     unsigned char    Dummy;        // Makes struct even. 
  102. } NoteInfo;
  103.  
  104.     // Main MIDIArp Data Structure.
  105. typedef struct 
  106. {    short        Locked;                    // Don't modify this structure while MIDIWakeUp active. 
  107.     NoteInfo    NoteTbl[noteTblSize];    // Which notes to arpeggiate. 
  108.     long        NoteIndex;                // Index into note table. 
  109.     short        NumNotes;                // Number of notes in NoteTbl. 
  110.     NoteInfo    LastNote;                // Most recently played note.
  111.     short        ArpPattern;                // Chord ArpPattern.  
  112.     short        ArpDirection;            // Chord direction. 
  113.     long        Tempo;                    // Tempo of arpeggiated notes. 
  114.     long        NextNoteOnTime;            // Time to play next note. 
  115.     short        InputRefNum;            // Input port reference number. 
  116.     short        OutputRefNum;            // Output port reference number. 
  117.     short        TimeRefNum;                // Time base port reference number. 
  118. } ArpParams;
  119.  
  120.  
  121. //
  122. //    Function protocalls.
  123. //
  124. extern void 
  125.     InitThings(void);
  126.  
  127. extern void 
  128.     ArpInit(void);
  129.  
  130. extern void
  131.     StartDialog(void);
  132.  
  133. extern void
  134.     RunDialog(void);
  135.     
  136. extern void
  137.     ArpClose(void);
  138.  
  139. extern void
  140.     StopDialog(void);
  141.     
  142. extern pascal short 
  143.     ArpReader(MIDIPacketPtr ThePacketPtr, long TheRefCon);
  144.  
  145. extern pascal void 
  146.     ArpTimeProc(long TheCurTime, long TheRefCon);
  147.     
  148. extern void
  149.     BumpNoteTableIndex(void);
  150.     
  151. extern void
  152.     PatchPorts(void);
  153.  
  154. extern void
  155.     SavePatch(OSType PortID, short PortInfoResID, char *PortInfoResName);
  156.  
  157. extern char *
  158.     StdMacVerNumToStr(long VerNum, char *VerStr);
  159.     
  160. extern void 
  161.     Terminate(void);
  162.  
  163. extern void 
  164.     AdjustMenus(void);
  165.     
  166. extern void 
  167.     DoMenuCommand(long MenuResult);
  168.     
  169. extern void
  170.     StdSaveDLOGLocation(DialogPtr TheDialogPtr, short TheDialogID);
  171.     
  172. extern void
  173.     StdAdjustDLOGLocation(DialogPtr TheDialogPtr);
  174.  
  175. extern void 
  176.     SwitchRadio(DialogPtr TheDialog, short *CurRadio, short NextRadio);
  177.     
  178. extern void 
  179.     ChangeState(DialogPtr TheDialog, short State, short ItemNo);
  180.     
  181. extern void
  182.     ArpAlert(char *TheMessage);
  183.     
  184. extern char *
  185.     C2PStrCpy(char *Cstr, Str255 Pstr);
  186.     
  187. extern Boolean 
  188.     IsDAWindow(WindowPtr Window);
  189.  
  190. extern Boolean 
  191.     IsAppWindow(WindowPtr Window);
  192.     
  193. extern void
  194.     StdHiliteButton(DialogPtr TheDialog, short TheItemID);
  195.     
  196. extern short 
  197.     Seed(void);
  198.     
  199. extern short 
  200.     Choose(short Max);
  201.  
  202. extern void
  203.     ReportResError(char *Msg);